﻿using J.Status.Application.Command.RoomTypeCommand;
using J.StatusModel;
using J.StatusModel.Dto;
using MediatR;
using StatusService;

namespace J.Status.Application.Handler.RoomTypeHandler
{
    public class RoomTypeShowHandler : IRequestHandler<RoomTypeShowCommand, (int totalCount, int pageCount, List<RoomTypeCountDto> list)>
    {
        private readonly IRoomTypeService _roomTypeService;

        public RoomTypeShowHandler(IRoomTypeService roomTypeService)
        {
            _roomTypeService = roomTypeService;
        }

        public async Task<(int totalCount, int pageCount, List<RoomTypeCountDto> list)> Handle(RoomTypeShowCommand request, CancellationToken cancellationToken)
        {
            return await _roomTypeService.GetRoomType(request.pageIndex, request.pageSize, request.roomTypeName);
        }
    }
}
